Running Programmes and Evaluating Functions

After defining and storing a programme or function, you can use it from an application. All the applications can evaluate functions, but only the Calculator and Notes applications can run programmes.

The programme statements are executed in sequential order (although some commands alter the programme flow). The output, if any, is displayed in the application’s work area.

Programme execution continues until it reaches the last statement or a Stop command.
Function execution continues until it reaches a Return command.

Running a Programme or Function from the Programme Editor

1. Make sure you have defined a programme or function and the Programme Editor is the active pane (computer) or page (handheld).
2. On the toolbar, click the Document Tools button and select Check Syntax & Store > Run.
—or—
Press Ctrl+R.

Handheld: Press b 2 3, or press / R.

This will automatically:

check the syntax and store the programme or function,
paste the programme or function name on the first available line of the Calculator application immediately following the Programme Editor. If no Calculator exists in that position, a new one is inserted.

3. If the programme or function requires you to supply one or more arguments, type the values or variable names inside the parentheses.
4. Press ·.

Note: You can also run a programme or function in Calculator or Notes applications by typing the name of the programme with parentheses and any required arguments and pressing ·.

Using Short and Long Names

Anytime you are in the same problem where an object is defined, you can access it by entering its short name (the name given in the object’s Define command). This is the case for all defined objects, including private, public and non-library objects.

You can access a library object from any document by typing the object’s long name. A long name consists of the name of the object’s library document followed by a backslash “\” followed by the name of the object. For example, the long name of the object defined as func1 in the library document lib1 is lib1\func1. To type the “\” character on the handheld, press g p.

Note: If you cannot remember the exact name or the order of arguments required for a private library object, you can open the library document or use the Programme Editor to view the object. You also can use getVarInfo to view a list of objects in a library.

Using a Public Library Programme or Function

1. Make sure you have defined the object in the document’s first problem, stored the object, saved the library document in the MyLib folder, and refreshed the libraries.
2. Open the TI-Nspire™ application in which you want to use the programme or function.

Note: All applications can evaluate functions, but only the Calculator and Notes applications can run programmes.

3. Open the Catalogue and use the library tab to find and insert the object.
—or—
Type the name of the object. In the case of a programme or function, always follow the name with parentheses.

libs2\func1()

4. If the programme or function requires you to supply one or more arguments, type the values or variable names inside the parentheses.

libs2\func1(34,power)

5. Press ·.

Using a Private Library Programme or Function

To use a Private library object, you must know its long name. For example, the long name of the object defined as func1 in the library document lib1 is lib1\func1.

Note: If you cannot remember the exact name or the order of arguments required for a private library object, you can open the library document or use the Programme Editor to view the object.

1. Make sure you have defined the object in the document’s first problem, stored the object, saved the library document in the MyLib folder, and refreshed the libraries.
2. Open the TI-Nspire™ application in which you want to use the programme or function.

Note: All applications can evaluate functions, but only the Calculator and Notes applications can run programmes.

3. Type the name of the object. In the case of a programme or function, always follow the name with parentheses.

libs2\func1()

4. If the object requires you to supply one or more arguments, type the values or variable names inside the parentheses.

libs2\func1(34,power)

5. Press ·.

Interrupting a Running Programme or Function

While a programme or function is running, the busy pointer } is displayed.

To stop the programme or function,
- Windows®: Hold down the F12 key and press Enter repeatedly.
- Mac®: Hold down the F5 key and press Enter repeatedly.
- Handheld: Hold down the c key and press · repeatedly.

A message is displayed. To edit the programme or function in the Programme Editor, select Go To. The cursor appears at the command where the break occurred.